package idv.jieh.language.struts;

import org.apache.struts.util.*;
import java.util.Locale;

public class MyMessageResources extends PropertyMessageResources {

  public MyMessageResources(
    MessageResourcesFactory factory,
    String config)
  {
    super(factory, config);
  }


  public MyMessageResources(
    MessageResourcesFactory factory,
    String config, boolean returnNull)
  {
    super(factory, config, returnNull);
  }


  public void updateMessage(
    Locale locale,
    String key,
    String value)
  {
    synchronized(formats){
      formats.remove(messageKey(localeKey(locale), key));
      // 我想這是另一個環節; 造成無法重抓的原因
      // 試著直接呼叫 getMessage(Locale locale, String key) 就會發現了
    }
    synchronized(messages){
      messages.put(messageKey(localeKey(locale), key), value);
    }
  }
}
